package org.despair2D.ui 
{
	import org.despair2D.core.getClassName;
	import org.despair2D.debug.Logger;
	
	import org.despair2D.core.ns_despair
	use namespace ns_despair;
	
	
	/**
	 * @usage	状态的生命只有一次，不可重复使用!!
	 * 
	 * <persona>
	 *     <layout code = "7" width = "200" height = "200"/>
	 *     <position x = "200" y = "200"/>
	 *     <Button id = "btnA" x = "10" y = "20" section = "btn_A"/>
	 *     <CheckBox id = "selectA" x = "10" y = "40" section = "select_A"/>
	 * </persona>
	 */
public class PersonaState
{
	
	public function PersonaState()
	{
		var name:String
		
		name         =  getClassName(this)
		m_stateName  =  name.substr(name.lastIndexOf(".") + 1)
	}
	
	
	
	/* 合体组 */
	final public function get group() : FusionGroup
	{
		return m_persona
	}
	
	
	/* 状态名称 */
	final public function get name() : String
	{
		return m_stateName
	}
	
	
	
	/**
	 * @inheritDoc
	 */
	public function enter() : void
	{
	}
	
	
	/**
	 * @inheritDoc
	 */
	public function exit() : void
	{
	}
	
	
	
	ns_despair function preEnter() : void
	{
		if (m_initialized)
		{
			Logger.reportError(this, 'preEnter', '状态已初期化...')
		}
		
		else
		{
			m_initialized = true
		}
		
		// 反射组件实例
		// ....
		
		//if (m_body)
		//{
			//m_body.move(m_bodyX, m_bodyY)
			//m_body.setLayout(m_code, m_width, m_height)
		//}
	}
	
	
	ns_despair function postEnter() : void
	{
		
	}
	
	
	/**
	 * 释放
	 */
	ns_despair function dispose() : void
	{
		m_persona  =  null
	}
	
	
	
	ns_despair var m_persona:Persona
	
	ns_despair var m_stateName:String
	
	ns_despair var m_initialized:Boolean
	
	// body
	
	ns_despair var m_code:int = 7
	
	ns_despair var m_width:Number
	
	ns_despair var m_height:Number
	
	//ns_despair var m_bodyX:Number = 0
	//
	//ns_despair var m_bodyY:Number = 0

	
}

}